package com.zshan.clinic.admin.producer;


import com.zshan.clinic.admin.constant.RedisKeyPrefix;
import com.zshan.clinic.common.constant.CommonConstant;
import com.zshan.clinic.common.util.redis.RedisUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
@Slf4j
public class AutoCheckinProducer {

    @Autowired
    private RedisUtil redisUtil;

    /**
     * 发送自动签到的延迟消息
     * @param registerId
     * @param seconds
     */
    public void submitDelaySeconds(Long registerId, long seconds) {
        log.info("发生mq延迟消息:{},延迟时间:{}",registerId,seconds);
        redisUtil.set(String.format(RedisKeyPrefix.AUTO_CHECKIN,registerId), CommonConstant.DEFAULT_1,CommonConstant.MINUTE_1);
    }
}

